﻿<include file="App/Home/Iphone/Public/header.html" />
<!--<link rel="stylesheet" type="text/css" href="--><!--/css/kline.assistant.js"/>-->
<!--<link rel="stylesheet" type="text/css" href="--><!--/css/kline.css?v=12"/>-->
<!--<link rel="stylesheet" type="text/css" href="--><!--/css/layer.css"/>-->
<!--<script src="--><!--/js/index.js?v=20161209"></script>-->

<script type="text/javascript" src="js/mcoinindex.js" ></script>
<!--<script src="--><!--/js/layer.js?v=1"></script>-->
<script src="js/socket.io.js"></script>


<script>onlineUsers = {userid: '73c1f5a456d5f7aae224e122ce8c7996', type: 'ans2cny'}; isOnline = 'online';</script>
<script src="__PUBLIC__/Iphone/js/jquery-2.0.3.js"></script>

<link rel="stylesheet" href="../css/boot.css">
<script src="__PUBLIC__/Iphone/js/jquery.cookie.js"></script>
<script src="__PUBLIC__/Iphone/js/bootstrap.js"></script>
<script src="__PUBLIC__/Iphone/js/slider.js"></script>
<script>
	b2width = 3;
		user = {uid:0, ybc_over:0, ybc_lock:0, cny_over:0, cny_lock:0, btc_over:0, btc_lock:0, ltc_over:0, ltc_lock:0, trmb_over:0, trmb_lock:0,email:'', name:''};
	</script>

<style>
    .j-tab3 thead tr th ,j-tab3 tbody  tr td  {
                width:24.5%;
                      }

</style>
<div class="strip"></div>
<div class="j-box1">

	<h2 style="text-indent: 0.1rem;">
		<img src="__PUBLIC__/Iphone/picture/coin_abc.png" style="float:left;margin-right:0px" />
		{$currency['currency_mark']}对 人民币
<!--                K线图-->
		<span onclick="clicks();">
			<!-- <img src="__PUBLIC__/Iphone/images/icon_kline_03.png" alt="" class="img"> -->
			<em class="return" style="display:none;color:#f60;margin-right:0.3rem; margin-top:0.2rem;float:right;height:0.5rem;font-size:13px;text-align:center;line-height:0.5rem">返回</em>
		</span>
	</h2>
    <table class="j_boxtab">
		<tr>
			<td>最新价</td>
			<td>最高价</td>
			<td>最低价</td>
			<td>成交量</td>
		</tr>
		<tr>
			<td class="se money" id='new_price'>{$currency_or['new_price']|default=0}</td>
			<td id='24h_max'>{$currency_or['zuigao']|default=0}</td>
			<td id='24h_min'>{$currency_or['zuidi']|default=0}</td>
			<td id='24h_count'>{$currency_or['all_num']|default=0}</td>
		</tr>
	</table>
</div>
<!--交易区域-->
<div id="trade_area">
	<div class="j-box2" style="padding: 0 0.3rem;position: relative;">

		<!--	导航-->
		<div class="j-nav">
			<a href="#" class="dangqian" >买入</a>
			<a href="#" >卖出</a>
			<a href="#" class="last">我的委托</a>
			<div style="clear: both;"></div>
		</div>
		<!--买入卖出-->
		<div class="">
			<div class="j-L">
				<div style="height: 5.76rem;">
				<table class="j-tabL latest_list weituo">
				<thead>
					<tr class="j-bg-c">
						<td></td>
						<td>单价</td>
						<td style="padding-right: 10px;">委托量</td>
					</tr>
					</thead>
					<tbody id="coinsalelist">
					<volist name='buy_record' key='k' id='vo'>
						<tr>
							<td class="j-colorG">买({$k})</</td>
							<td>{$vo.price|formatOrderNum=###}</td>
							<td><eq name="currency.currency_name" value="比特币" >{$vo['num']-$vo['trade_num']|number_format=###,3} <else/> {$vo['num']-$vo['trade_num']|number_format=###,2}</eq></td>
						</tr>
						</volist>
					</tbody>
				</table>
				<table class="j-tabL latest_list weituo">
					<thead>
					<tr class="j-bg-c">
						<td></td>
						<td>单价</td>
						<td style="padding-right: 10px;">委托量</td>
					</tr>
					</thead>
					<tbody id="coinbuylist">
					<volist name='sell_record' key='k' id='vo'>
						<tr>
							<td class="j-colorR">卖({$k})</td>
							<td>{$vo.price|formatOrderNum=###}</td>
							<td><eq name="currency.currency_name" value="比特币" > {$vo['num']-$vo['trade_num']|number_format=###,3} <else/>{$vo['num']-$vo['trade_num']|number_format=###,2}</eq></td>
						</tr>
						</volist>
					</tbody>
				</table>

				<table class="j-tabL1">
					<tbody id="colorhtml">
					</tbody>
				</table>
			</div>


				<a href="/moretrade/moretrust/name/ans2cny" style="margin-top:0.35rem;width:3.3rem;height:0.8rem;display:inline-block;line-height:0.8rem;text-align:center;font-size:0.3rem;border:1px solid #ddd;color:#666;display:none;border-radius: 5px;"  class="moretrust">更多委托</a>
			</div>
			<div class="buys" style="height:auto">
				<div class="j-R">
					<div style="position:relative;">
						<p class="j-p1_top" style="margin-bottom: 0.07rem;">
							<span>买入价格</span>
						</p>
					<input  class="j-p2" type="text"  name="buyprice" id="coinpricein" onkeyup="vNum(this,{$currency.currency_digit_num});zuidakemai();" >
                   <i style="position: absolute;z-index: 2;font-size: 0.22rem;right: 0.15rem;top:0.65rem;color: #999;">CNY</i>
					</div>
					<span class="j-p3" >可买：<span class="maxcoin"   style="font-weight: bold;"></span></span>
					
					<div style="position: relative">
					<p class="j-p1">买入数量</p>

					<input  type="text" class="coinbuy-number j-p2" name="buynum" id="numberin" onkeyup="vNum(this,{$currency.currency_digit_num});" autocomplete="off" placeholder="0"/>
					<i style="position: absolute;z-index: 2;font-size: 0.22rem;right: 0.15rem;top:0.65rem;color: #999;">{$currency['currency_mark']}</i>
					</div>
					<div style="position: relative;">
					<p class="j-p1" class="buys" style="clear: both">
						<span>交易额</span>

						<span class="posSpan1" style="float: right">手续费：0% {$currency['currency_mark']}</span>
					</p>

						<input class="coinbuy-number j-p2" readonly="true" name="total"  id="coinin_sumprice"  autocomplete="off" type="text" value="0.00" disabled="disabled">
					<i style="position: absolute;z-index: 2;font-size: 0.22rem;right: 0.15rem;top:0.65rem;color: #999;">CNY</i>
					</div>
					<p class="j-p1">交易密码</p>
						<input type="password" class="buyinput j-p2" id="pwdtradein" autocomplete="off"/>
					<div class="MaiChu">
						<input type="button" id="trustbtnin" onclick="if(confirm('确定买入?')==false)return false;buy()" class="submit" value="买入" style="
				background: red;font-size:0.3rem;border-radius: 5px;" />
					</div>
<script type="text/javascript" src="__PUBLIC__/Iphone/js/layer.js"></script>
<script>
function buy(){

	if($("#coinpricein").val()==""){
		$("#trustmsgin").text("买入价格不能为空").fadeOut(500).fadeIn(500).fadeOut(500).fadeIn(500).fadeOut(500).fadeIn(500);
		return false;
	}
	if($("#numberin").val()==""){
		$("#trustmsgin").text("买入数量不能为空").fadeOut(500).fadeIn(500).fadeOut(500).fadeIn(500).fadeOut(500).fadeIn(500);
		return false;
	}
	if($("#pwdtradein").val()==""){
		$("#trustmsgin").text("交易密码不能为空").fadeOut(500).fadeIn(500).fadeOut(500).fadeIn(500).fadeOut(500).fadeIn(500);
		return false;
	}
	if(($("#coinpricein").val())*($("#numberin").val())<1){
		$("#trustmsgin").text("交易额不能低于1元").fadeOut(500).fadeIn(500).fadeOut(500).fadeIn(500).fadeOut(500).fadeIn(500);
		return false;
	}
	layer.confirm('确定买入?', {
	  btn: ['确定','取消'] //按钮
	}, function(index){
		layer.close(index);
		$("body").append("<div id='loading' style='z-index:19891014; background-color:#000; opacity:0.3; filter:alpha(opacity=30);top: 0;left: 0;width: 100%;height: 100%;position: fixed;_position: absolute;text-align:center;'><img src='/public/home/images/loading.gif' style='margin-top:25%;' /></div>");
		$.ajax({
			type:"post",
			url:"{:U('Trade/buy')}",
			data:{buyprice:$("#coinpricein").val(),buynum:$("#numberin").val(),buypwd:$("#pwdtradein").val(),currency_id:$("#currency_id").val()},
			async:true,
			success: function(d){
				$("#loading").remove();
				if(d.status!=1){
				$("#trustmsgin").text(d.info).fadeOut(500).fadeIn(500).fadeOut(500).fadeIn(500).fadeOut(500).fadeIn(500);	
				//加一个提示
				layer.msg(d.info);
				}else{
				layer.msg(d.info);
				//刷新页面
				setTimeout(window.location.reload(),2000);
				}
			}
		});
	}, function(){
  layer.msg('已取消');
});
		<eq name="Think.session.is_phone" value="1" >  <else /> $('.layui-layer-dialog').css({position:'absolute',left:'3%',top:'55%'});</eq>
}
</script>

				</div>
				<div style="clear: both;"></div>

			</div>

			<div class="sales" style="height:auto;display:none">
				<div class="j-R">
										<div style="position: relative;">
					<p class="j-p1_top">卖出价格
											</p>
					<input type="text" class="buyinput j-p2" id="coinpriceout" onkeyup="vNum(this,4);sumsale(0.00200,4);">
					<i style="position: absolute;z-index: 2;font-size: 0.22rem;right: 0.15rem;top:0.65rem;color: #999;">CNY</i>
					</div>
					<p class="j-p3">可卖：<b id="coinsale_max" onclick="$('#numberout').val(this.innerHTML)" title="点击将数值写入数量输入框" style="font-weight: bold;">{$user_currency_money['currency']['num']}</b></p>
					<div style="display:none">
						卖出比例：
						<div id="sale-SliderVal" class="ratio">0%</div>
						<div id="sale-slider" data_slide='sale'></div>
					</div>
					<div style="position: relative;">
					<p class="j-p1" >卖出数量</p>
					<input type="text" class="buyinput coinsale-number j-p2" placeholder="0" id="numberout" onkeyup="vNum2(this,{$currency.currency_digit_num});" autocomplete="off"/>
					<i style="position: absolute;z-index: 2;font-size: 0.22rem;right: 0.15rem;top:0.65rem;color: #999;">NEO</i>
					</div>
					<div style="position: relative;">
					<p class="j-p1" class="buys">交易额
					<span class="posSpan1" style="float: right">手续费：<i>0.2% CNY</i></span>
					</p>
					<input type="text" class="buyinput coinsale-number j-p2" id="coinout_sumprice" name="total"  value="0.00CNY" disabled="disabled" autocomplete="off"/>
					<i style="position: absolute;z-index: 2;font-size: 0.22rem;right: 0.15rem;top:0.65rem;color: #999;">CNY</i>
					</div>
					<!--<p class="j-p1"><b id="fee">0.00</b><span>（% ）</span></p>-->
											<p class="j-p1">交易密码</p>
						<input type="password" class="buyinput j-p2" id="pwdtradeout"  value="{$Think.session.tradepwd}"autocomplete="off"/>
										<div class="MaiChu">
						<input type="button" class="submit" id="trustbtnout" value="卖出" onclick="if(confirm('确定卖出?')==false)return false;sell()" style="
			background: #669900;font-size:0.3rem;border-radius: 5px; " />
					</div>
				</div>
				<script>
				function sell(){
	var cname=$("#cname").val();
	if($("#coinpriceout").val()==""){
		$("#trustmsgout").text("卖出价格不能为空").fadeOut(500).fadeIn(500).fadeOut(500).fadeIn(500).fadeOut(500).fadeIn(500);
		return false;
	}
	if($("#numberout").val()==""){
		$("#trustmsgout").text("卖出数量不能为空").fadeOut(500).fadeIn(500).fadeOut(500).fadeIn(500).fadeOut(500).fadeIn(500);
		return false;
	}
	if($("#pwdtradeout").val()==""){
		$("#trustmsgout").text("交易密码不能为空").fadeOut(500).fadeIn(500).fadeOut(500).fadeIn(500).fadeOut(500).fadeIn(500);
		return false;
	}
	if(($("#coinpriceout").val())*($("#numberout").val())<1){
		$("#trustmsgout").text("交易额不能低于1元").fadeOut(500).fadeIn(500).fadeOut(500).fadeIn(500).fadeOut(500).fadeIn(500);
		return false;
	}

	layer.confirm('确定卖出?', { 
		  btn: ['确定','取消'] //按钮
		  
		}, function(index){
			layer.close(index);
			$("body").append("<div id='loading' style='z-index:19891014; background-color:#000; opacity:0.3; filter:alpha(opacity=30);top: 0;left: 0;width: 100%;height: 100%;position: fixed;_position: absolute;text-align:center;'><img src='/public/home/images/loading.gif' style='margin-top:25%;' /></div>");
			$.ajax({
				type:"post",
				url:"{:U('Trade/sell')}",
				data:{sellprice:$("#coinpriceout").val(),sellnum:$("#numberout").val(),sellpwd:$("#pwdtradeout").val(),'currency_id':$("#currency_id").val()},
				async:true,
				success: function(d){
					$("#loading").remove();
					if(d.status!=1){
					$("#trustmsgout").text(d.info).fadeOut(500).fadeIn(500).fadeOut(500).fadeIn(500).fadeOut(500).fadeIn(500);	
					//加一个提示
					layer.msg(d.info);
					}else{
					layer.msg(d.info);
					//刷新页面
					setTimeout(window.location.reload(),2000);
					}
				}
			});
}, function(){
  layer.msg('已取消');
});
	
	<eq name="Think.session.is_phone" value="1" > <else />$('.layui-layer-dialog').css({position:'absolute',left:'45%',top:'55%'}) </eq>
	

}</script>
				<div style="clear: both;"></div>

			</div>
			<!--提示-->
			<div class="msg" style="height:35px;font-size:13px;text-align:center;line-height:35px;">
				<span  style="color:red">数字货币交易具有极高的风险，投资需谨慎！</span>
			</div>

		</div>
		<!--	我的委托-->
		<div class="mywait wt-box2" style="display:none;">
<!--			<div id="bg-f"></div>-->
			<table class="tab_wt">
				<thead>
				<tr>
					<th>类型</th>
					<th>委托价格</th>
					<th>委托数量</th>
					<th>委托时间</th>
					
				</tr>
				</thead>
			</table>

			<div class="tab_overflow">
				<table>
					<tbody id="mycointrustlist">
					<foreach name='user_orders' item='v'>
					<tr>
						<td class="sell" style="color:#690">{$v['type']|fomatOrdersType=###}</td>
						<td class="sell"><font color="#690">{$v.price|number_format=###,$currency['currency_digit_num']}</font></td>
						<td class="tableEnd">{$v['num']-$v['trade_num']|number_format=###,2}</td>
						<td class="tableEnd">{$v.add_time|date=' H:i:s',###}</td>


					</tr>
					 </foreach>
					</tbody >
				</table>
				<div class="much" style="display:none;font-size:12px;text-align:center;height:40px;line-height:40px">
					无更多内容
				</div>
			</div>
		</div>

	</div>
	<div style="clear: both;"></div>
	<!--成交记录-->
		<div class="j-box3 su_log">
				<h3 style="margin-top:0px"><span class="history_order">成交记录</span></h3>
				<table class="j-tab3 log_history" >
			<thead>
			<tr>
				<th>成交时间</th>
<!--				<th>类型</th>-->
				<th>成交价</th>
				<th>成交量</th>
				<th>总金额（CNY）</th>
			</tr>
			</thead>
			<tbody id="coinorderlist">
            <volist name='trade' id='vo'>
			<tr>
				<td class="sell" style="color:#690">{$vo.add_time|date=' H:i:s',###}</td>
				<td class="sell"><font color="#690">{$vo.price|number_format=###,$currency['currency_digit_num']}</font></td>
				<td class="sell"><font color="#690">{$vo.num|number_format=###,4}</font></td>
				<td class="tableEnd">{$vo['num']*$vo['price']|number_format=###,4}</td>
				


			</tr>
			</volist>
			</tbody>
		</table>
		<!--	我的成交-->
		<div class="mysuccess" style="display:none">
			<table class="j-tab3">
				<thead>
				<tr>
					<th>成交时间</th>
					<th>成交价</th>
					<th>委托量</th>
					<th>成交总价</th>
				</tr>
				</thead>
				<tbody id="mysuccess">
				

				</tbody>
			</table>

			<div class="j-div3">
				<a href="javascript:;" id="more"></a>
			</div>
		</div>

		<format id="price_float" data="4"></format>
	</div>
	<!--委托历史-->
	<!-- <div class="j-box3 wt-box3" style="display:none">
		<h3>
			<select id="status" >
				<option value="4" selected="selected" >全部</option>
				<option value="1" >部分成交</option>
				<option value="2" >已成交</option>
				<option value="3" >已撤销</option>
			</select>
		</h3>
		<table class="j-tab3">
			<thead>
			<tr>
				<th>成交时间</th>
				<th>委托价</th>
				<th>委托量</th>
				<th>状态</th>
			</tr>
			</thead>
			<tbody id="trust_history">

			</tbody>
		</table>
		<div class="j-div3">
			<a href="javascript:;" id="more_history"></a>
		</div>
	</div> -->
</div>

<!--k线-->
<div id="kline" class="j-box2" style="display:none">
	<iframe style="border: 0px; width: 100%; height: 565px;" src="/market?symbol=ans2cny"/></iframe>
</div>

<!--隐藏值-->
<div class="hiddenValue" style="display:none">
	<input type="hidden" value="neo2cny" id="coinnames">
	<input type="hidden" value="CNY" class="cointo">
	<input type="hidden" id="pnumber">
	<input type="hidden" id="historynum">
	<input type="hidden" id="logid" value="">
	<ul>
		<li>买一价 / 卖一价<br /><span id='24h_sell'>加载中...</span><span> / </span><span id='24h_buy'>加载中...</span></li>
	</ul>
</div>

<!-- <footer class="footer">
      <div class="footer_kefu_news">
        <a href="tel:4008367667"><i></i>4008-367-667</a>
        <a><i></i>ybw@yuanbao.com</a>
    </div>
    <p>
        <span>
            <a href="javascript:void(0);" class="a1" id="phone">手机版</a>
            <i>|</i>
            <a href="javascript:void(0);" class="a2" id="window">电脑版</a>

        </span>
    </p>
<!--    <p  style="text-align:center" >
			<span>
			<a href="javascript:void(0);" class="a1" id="phone">手机版</a>
				<i>|</i>
				<a href="javascript:void(0);" class="a2" id="window">电脑版</a>
			</span>
            </p>
  
    <div>
        Copyright2013-2016 元宝网
    </div>
</footer> -->
<!--<script>
    //域名跳转
    $('#phone').click(function(){
        location.reload();
    })
    $('#window').click(function(){
        var mode = 1;
        $.post('/ajax/changemode',{mode:mode},function(){
            window.location.href = 'http://www.yuanbao.com/coins?notice=1';
        })
    })
</script>-->
<script>
    /*$('#phone').click(function(){
     $.post('/ajax/changemode',{mode:0},function(){
     location.reload();
     })
     })*/
    $('#window').click(function(){
        $.post('/ajax/changemode',{mode:1},function(){
            window.location.href = 'https://www.yuanbao.com/coins?notice=1';
        })
    })
</script><script type="text/javascript"></script>
<!--<script src="js/highstock.js"></script>
<script src="js/e4dd34430394495c91d325d1534ef4fa.js"></script>
<script src="js/281d1ca15a0c4884a957373d43273ca5.js"></script>
<script src="js/ca5cfa39b3d84a4ba72f5820df994737.js"></script>
<script src="js/70c5a026ec534d708d22723453743150.js"></script>
<script src="js/e781b478d5a2437c923e7d922c48ea83.js"></script>
<script src="js/212a1afa11cf4191a8bd4a5c38dbe16e.js"></script>
<script src="js/kline.js"></script>-->
<script type="text/javascript" src="__PUBLIC__/Iphone/js/zepto_1.js"></script>
<script src="__PUBLIC__/Iphone/js/public_1.js"></script>
<script>

	$(".j-nav").on("tap","a",function(){
		var coinname = $('#coinnames').val();
		$(this).addClass('dangqian').siblings().removeClass("dangqian");
		var i = $(this).index();
		if(i == 0){
			$('.sales').css('display','none');
			$('.mywait').css('display','none');
			$('.wt-box3').css('display','none');	//委托历史
			$('.j-L').css('display','block');		//左侧委托记录
			$('.buys').css('display','block');		//买入
			$('.su_log').css('display','block');	//成交记录
			$('.Hclick').css('display','block');
			$('.msg').css('display','block');	//买入提示

		}else if(i == 1){
			$('.buys').css('display','none');
			$('.mywait').css('display','none');
			$('.wt-box3').css('display','none');
			$('.msg').css('display','block');	//买入提示隐藏
			$('.j-L').css('display','block');
			$('.sales').css('display','block');
			$('.su_log').css('display','block');
			$('.Hclick').css('display','block');

		}else{
			if($('#logid').val() == false){
//				window.location="/user/login";
//				return false;
			}
			$('.buys').css('display','none');
			$('.sales').css('display','none');
			$('.j-L').css('display','none');
			$('.msg').css('display','none');	//买入提示隐藏
			$('.su_log').css('display','none');
			$('.Hclick').css('display','none');
			$('.wt-box3').css('display','block');
			$('.mywait').css('display','block');
//			我的委托
			mycointrust();
			var page = 0;
			history(coinname,page);
		}
	})

	//成交记录
	$(".Hclick").on("click","span", function () {
		$(this).addClass("spanBottom").siblings("span").removeClass("spanBottom")
	})
	$('.history_order').click(function(){
		//隐藏成交记录，显示我的成交
		$('.mysuccess').css('display','none');
		$('.log_history').css('display','block');
		$('.log_history').removeAttr('style');
	})

	//我的成交
	$('.mysuorder').click(function(){
		//隐藏成交记录，显示我的成交
		$('.log_history').css('display','none');
		$('.mysuccess').css('display','block');
		$(this).addClass(".spanBottom")
		var page = 0;
		var coinname = $('#coinnames').val();
		coinordersuccess(coinname,page);
	})

	//我的成交加载更多
	$('#more').click(function(){
		var coinname = $('#coinnames').val();
		var page = $('#pnumber').val();
		coinordersuccess(coinname,page);
	})
	//委托历史加载更多
	$('#more_history').click(function(){
		var coinname = $('#coinnames').val();
		var page = $('#historynum').val();
		history(coinname,page);
	})

	//委托历史下拉选择
	$('#status').change(function(){
		var coinname = $('#coinnames').val();
		var page = 0;
//		$('#more_history').html('↓  显示更多');
		history(coinname,page);
	})

	//K线显示
	var flags = true;	//声明全局变量
	function clicks(){
		if(flags == true){
			//图标隐藏
			$('.img').css('display','none');
			$('.return').css('display','block');

			$('#trade_area').css('display','none');
			$('#kline').css('display','block');
		}else{
			$('.img').css('display','block');
			$('.return').css('display','none');

			$('#trade_area').css('display','block');
			$('#kline').css('display','none');
		}
		flags = !flags;
	}
</script>
<script>



function zuidakemai(){

	if($("#coinpricein").val()!="" && $("#coinpricein").val()!=0){
		var m = {$user_currency_money.currency_trade.num|default=0};
		var fee={$currency.currency_buy_fee}/100;
		m=m*(1-fee);
		var n = parseFloat($("#coinpricein").val());
		
		$(".maxcoin").text(Math.round(m/n*10000)/10000);
	}else{
		$(".maxcoin").text(0);
	}
}
</script>
<script>
function vNum(o, len){
	if($("#coinpricein").val()!="" || $("#coinpricein").val()!="此出价为1个币的价格" && $("#numberin").val()!=""){

    if(badFloat(o.value, len))
		  o.value=formatfloat(o.value,len,0);

      var zuidakemai = $(".maxcoin").text();
       zuidakemai=formatfloat(zuidakemai,len,0);
      if($("#numberin").val() > zuidakemai){
        $("#numberin").val(zuidakemai);
      }
		  var fee2 = {$currency.currency_buy_fee} / 100;
		  var ci = $("#coinpricein").val()*$("#numberin").val();
		  var ct2 = ci ;//+ ci * fee2;


		$("#feebuy").text(Math.round(ci*fee2*10000)/10000);
		$("#coinin_sumprice").val(Math.round(ct2*10000)/10000);
	}
}
function vNum2(o, len){
	var zuida = $("#coinsale_max").text();
	//alert(zuida);
	
		//$("#numberout").val()=formatfloat($("#numberout").val(), len, 0);
		zuida=formatfloat(zuida, len, 4);
		//alert(o.value);
	
	if($("#numberout").val() > zuida){
		$("#numberout").val(zuida);
		//alert(234);
	}
	//alert(o.value);
	if($("#coinpriceout").val()!="" || $("#coinpriceout").val()!="此出价为1个币的价格" && $("#numberout").val()!=""){
	if(badFloat(o.value, len))
		o.value=formatfloat(o.value, len, 0);
	var nt = $("#coinpriceout").val()*$("#numberout").val();
	var fee = {$currency.currency_sell_fee} /100;
	var ct = nt;// - nt * fee;
  // alert(nt);
  // alert(fee);

	
	$("#fee").text(Math.round(nt*fee*10000)/10000);
	$("#coinout_sumprice").val(Math.round(ct*10000)/10000);
	}
	
}
</script>
<script>
	$(function(){
		$("#coinsalelist").on('mouseover','tr', function(){
			$(this).css('cursor', 'pointer');
		});
		$("#coinbuylist").on('mouseover','tr', function(){
			$(this).css('cursor', 'pointer');
		});
		$("#coinsalelist").on('click','tr', function(){
			$("#coinpricein").val($(this).find('td:nth-child(2)').text());
			$("#coinpriceout").val($(this).find('td:nth-child(2)').text());
			//$("#numberin").val($(this).find('td:nth-child(3)').text());
		});
		$("#coinbuylist").on('click','tr', function(){
			$("#coinpricein").val($(this).find('td:nth-child(2)').text());
			$("#coinpriceout").val($(this).find('td:nth-child(2)').text());
			//$("#numberout").val($(this).find('td:nth-child(3)').text());
		});
				// 买入/卖出 比例
		function slider(){
			var type = ['sale','buy'];
			for(var i in type){
				var numcoin=parseFloat($("input.coin"+type[i]+"-number").val(),2);
				var maxnum=parseFloat($("#coin"+type[i]+'_max').text(),2);
				var per=Math.floor(numcoin*100/maxnum,2,0);
				if(isNaN(per)){
					per=0;
				}
				if(per>100){
					per=100;
				}
				$("input.coin"+type[i]+"-number").unbind('input').on("input",function(){
					slider();
				});
				$("#"+type[i]+"-SliderVal").html(per+"%");
				$( "#"+type[i]+"-slider" ).slider({
					range: "min",
					value: per,
					min: 0,
					max: 100,
					step:10,
					slide: function( event, ui ) {
						var type = $(ui.handle).attr('data_slide');
						var e = parseFloat($("#coin"+type+'_max').text());
						if(isNaN(e)) e=0;
						if(ui.value==100){
							$("input.coin"+type+"-number").val(e);
						}else{
							var length=4;
							$("input.coin"+type+"-number").val(formatfloat(e * ui.value/100, length));
						}
						if(type=="buy"){
							sumbuy(0.00000,4);
						}else{
							sumsale(0.00200,4);
						}
						$("#"+type+"-SliderVal").html(ui.value+"%");
					}
				});
			}
		}
		slider();

	})

</script>

</body>
</html>
